<html>
<head><meta charset="utf-8"><title>where is the code for universal impl trait and existential · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html">where is the code for universal impl trait and existential</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214396222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20is%20the%20code%20for%20universal%20impl%20trait%20and%20existential/near/214396222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> sfzhu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html#214396222">(Oct 23 2020 at 23:16)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/lowering.html">https://rustc-dev-guide.rust-lang.org/lowering.html</a> says we have Universal impl Trait and existential traits. How can I know the related code of this part?</p>



<a name="214396260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20is%20the%20code%20for%20universal%20impl%20trait%20and%20existential/near/214396260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html#214396260">(Oct 23 2020 at 23:17)</a>:</h4>
<p>existential impl trait is <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TyKind.html#variant.OpaqueDef">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.TyKind.html#variant.OpaqueDef</a></p>



<a name="214396291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20is%20the%20code%20for%20universal%20impl%20trait%20and%20existential/near/214396291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html#214396291">(Oct 23 2020 at 23:17)</a>:</h4>
<p>universal traits will be handled somewhere in <code>rustc_ast_lowering</code> I think</p>



<a name="214397156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20is%20the%20code%20for%20universal%20impl%20trait%20and%20existential/near/214397156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> sfzhu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html#214397156">(Oct 23 2020 at 23:33)</a>:</h4>
<p>Interesting, why it is called opaque types right now?</p>



<a name="214401388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20is%20the%20code%20for%20universal%20impl%20trait%20and%20existential/near/214401388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20is.20the.20code.20for.20universal.20impl.20trait.20and.20existential.html#214401388">(Oct 24 2020 at 01:03)</a>:</h4>
<p>I <em>think</em> because you don't know what concrete type is represented by <code>impl Trait</code>; all you know is that it implements that trait. It acts like it's a concrete type (i.e. you don't need to quantify it with <code>&lt;T&gt;</code> somewhere) but it's actually not.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>